<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
    
    <title>My JSP 'register.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/AjaxUsersDAO.js"></script>
	<script type="text/javascript">
		function check(){
			var username=document.all.userName.value;
			if(username==""){
				window.alert("用户名不能为空！");
				return ;
			}
			AjaxUsersDAO.existUsers(username,show);
		}
		function show(data){
			if(data){
				window.alert("用户已经被使用！");
				return ;
			}
			window.alert("用户可以使用！");
		}
	</script>
  </head>
  
  <body>
    <div align="center">
    	<form action="register.action" methon="post">
    		用户注册<br><br>
    		<table>
    			<tr><td align="right">用户名</td><td><input type="text" name="users.userName" id="userName" onblur="check()"></td></tr>
    			<tr><td align="right">密码</td><td><input type="password" name="users.password" id="password"></td></tr>
    			<tr><td align="right">email</td><td><input type="text" name="users.email" id="email" ></td></tr>
    		
    		</table>
    		<br>
    		<input type="submit" value="注册">
    	</form>
    </div>
  </body>
</html>
